package com.ecp.commons.bean;

import java.util.Date;

import com.ecp.commons.annotation.VariantType;
import com.ecp.commons.serialization.GenericBean;
import com.ecp.commons.serialization.Variant;

public class Article extends GenericBean {

	@Override
	public void defineVariantSet() {
		this.entity = "cms_article";
		map.put("id", new Variant().setType(VariantType.INTEGER).setPk(true).setNullable(false));
		map.put("columnId", new Variant().setType(VariantType.INTEGER));
		map.put("Title", new Variant().setLength(0));
		map.put("content", new Variant().setLength(-1));
		map.put("sortPos", new Variant().setType(VariantType.INTEGER));
		map.put("createDate", new Variant().setType(VariantType.DATETIME));
		map.put("lastModifyDate", new Variant().setType(VariantType.DATETIME));
		map.put("certifyState", new Variant().setType(VariantType.INTEGER));
		map.put("certifyUserId", new Variant().setType(VariantType.INTEGER));
		map.put("certifyDate", new Variant().setType(VariantType.DATETIME));

	}

	@Override
	public void resetValues() {
		this.set("id", "");
		this.set("columnId", "");
		this.set("Title", "");
		this.set("content", "");
		this.set("sortPos", "");
		this.set("createDate", "");
		this.set("creatorId", "0");
		this.set("lastModifyDate", "");
		this.set("certifyUserId", "0");
		this.set("certifyDate", "");
	}

	public int getId() {
		return this.getInt("id");
	}

	public int getColumnId() {
		return this.getInt("columnId");
	}

	public String getTitle() {
		return this.getString("Title");
	}

	public String getContent() {
		return this.getString("content");
	}

	public int getSortPos() {
		return this.getInt("sortPos");
	}

	public Date getCreateDate() {
		return this.getDate("createDate");
	}

	public Date getLastModifyDate() {
		return this.getDate("lastModifyDate");
	}

	public int getCertifyUserId() {
		return this.getInt("certifyUserId");
	}

	public Date getCertifyDate() {
		return this.getDate("certifyDate");
	}

	public void setId(int id) {
		this.set("id", id);
	}

	public void setColumnId(int columnId) {
		this.set("columnId", columnId);
	}

	public void setTitle(String Title) {
		this.set("Title", Title);
	}

	public void setContent(String content) {
		this.set("content", content);
	}

	public void setSortPos(int sortPos) {
		this.set("sortPos", sortPos);
	}

	public void setCreateDate(Date createDate) {
		this.set("createDate", createDate);
	}

	public void setCreatorId(int creatorId) {
		this.set("creatorId", creatorId);
	}

	public void setLastModifyDate(Date lastModifyDate) {
		this.set("lastModifyDate", lastModifyDate);
	}

	public void setCertifyUserId(int certifyUserId) {
		this.set("certifyUserId", certifyUserId);
	}

	public void setCertifyDate(Date certifyDate) {
		this.set("certifyDate", certifyDate);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + getId();
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Article other = (Article) obj;
		if (getId() != other.getId())
			return false;
		return true;
	}
}